1. Field of the Invention
The present invention relates generally to the design of a computer system that supports an object-based memory hierarchy where the system manages objects. More specifically, the present invention relates to a method and apparatus for the efficient allocation of memory, by pre-allocating physical memory addresses to object identifiers.
2. Description of the Related Art
As object-based systems become widespread, the need for storing a large number of objects is becoming increasingly important. As processor speeds rise, these object stores need to provide fast access to large collections of repeatedly used objects so that system throughput is not interrupted.
FIG. 1 illustrates an example of a typical memory hierarchy for a conventional object-based system 100. The system 100 includes a processor 110, which is connected to an object cache 112. The object cache 112 is connected to a translator 114, which is connected to main memory 118. The main memory 118 is indexed by physical addresses 119 and is shown to include an object table 116.
The object cache 112 is a form of fast memory holding recently accessed objects. A cache line in the object cache 112 generally contains part of an object or a whole object. The objects stored in the object cache 112 are accessed through load or store instructions. Within each such instruction, the part of the object being accessed is identified by two components, an object identifier (OID) and an offset. These two components form an address which is used to access the objects stored in the object cache 112 without having to access the main memory 118.
However the problem arises when there is a cache miss such as a load or store request that cannot be satisfied by the object cache 112. In such situations the main memory has to be accessed using a physical address 119. The translator 114 uses an object table 116 to obtain the physical address 119 corresponding to an object, as illustrated by arrow 115. For each object in the main memory 118 there is a corresponding object table entry 117 that contains the corresponding physical address 119. The translator 114 uses the OID as an index into the object table 116 to obtain the physical address 119 for an object.
In the above described scheme, the translator 114 is also assigned the task of allocating memory when a new object is to be stored in the main memory 118. The allocation process through the translator 114 involves finding the object table entry 116 and assigning to it a free memory address range in the main memory 1118. However, the process of going through the translator 114 to allocate memory space in the main memory 118 can be time consuming and may result in delay. Furthermore, in cases where a garbage collector deallocates objects which are no longer in use, in order to reclaim memory, the objects need to be completely dismantled. The garbage collector may be required to clear the object table entry 117 for each reclaimed object, which is likely to entail a cache miss. Later, when the same OID is reused, the object table entry 117 must be rebuilt, which again is likely to entail a cache miss. These additional steps can significantly slow both the allocation and reclamation operations.
Also, at the present time the memory allocation by the translator 114 is accomplished by hardwiring an allocation strategy into the translator. This complicates the design of the translator. As there are different types of allocating algorithms presently available it would be limiting on the functionality of an object-based system to have a particular allocation strategy hardwired into the translator for the life of the system.
In view of the foregoing, there is a need for an object-based system that simplifies the process of translating and allocating memory space when objects are to be stored in the main memory, and further, there is a need for an allocation scheme that can be easily improved or modified in accordance with improvements in technology or application.